<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2015/8/11
 * Time: 11:40
 */

namespace Home\Controller;

use Think\Controller;
class ShoppingCartController extends Controller{
    public function showCart(){
        $userInfo=session("UserInfo");
        $cart=D("ShoppingCart");
        $cartInfo=$cart->getCart($userInfo['id']);
        //var_dump($cartInfo);
        $this->assign("cartInfo",$cartInfo);
        $this->display('User/cart');
    }

    public function delCart(){
        $cart=D("ShoppingCart");
        if(!empty($_GET)){
            $delId = $cart->deleteByID($_GET);
            echo json_encode($delId);
        }
    }
}